#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
long long a1, a2, b1, b2, c1, c2, d1, d2;

/*
【a1,a2】,【b1,b2】能凑多少种数字k
*/

int equal_K(int k, int a1, int a2, int b1, int b2) {
  if (k < a1 + b1 || k > a2 + b2)
    return 0;
  k -= a1 + b1;
  a2 -= a1;
  b2 -= b1;
  a1 = 0;
  b1 = 0;
  int M = min(a2, b2) + 1;
  if (k <= M - 1)
    return k + 1;
  else if (k > a2 + b2 + 1 - M)
    return (a2 + b2 - k + 1);
  else
    return M;
}

int dayu_K(int k, int a1, int a2, int b1, int b2) {
  if (k < a1 + b1 || k > a2 + b2)
    return 0;
  k -= a1 + b1;
  a2 -= a1;
  b2 -= b1;
  a1 = 0;
  b1 = 0;
  int M = min(a2, b2) + 1;
  int sum = (1 + M) * M - M + ((a2 + b2 + 1) - (2 * M - 1)) * M;
  // cout << sum;

  if (k <= M - 1)
    return sum - (1 + k + 1) * (k + 1) / 2;
  else if (k <= a2 + b2 + 1 - M) {
    int t = k - (M - 1);
    return sum - (1 + M) * M / 2 - t * M;
  } else {
    int t = a2 + b2 - k;
    return (1 + t) * t / 2;
  }
}
int paichu(int a1, int a2, int b1, int b2, int c1, int c2, int d1, int d2) {
  long long  ans = 0;
  for (int i = a1; i <= a2; i++) {
    for (int j = b1; j <= b2; j++) {
      int x = equal_K(i + j, a1, b1, a2, b2);
      int y = dayu_K(i + j, -c2, -c1, d1, d2);
      (ans += (x * y) % MOD) %= MOD;
    }
  }
  return ans;
}

int main() {
  // for (int i = 0; i <= 18; i++) {
  //   cout << equal_K(i, 0, 5, 0, 13) << endl;
  // }
  // cout << endl;
  // for(int i=0;i<=7;i++){
  //    cout << dayu_K(i, 0, 5, 0, 2)<<endl;
  // }

  cin >> a1 >> a2 >> b1 >> b2 >> c1 >> c2 >> d1 >> d2;

  int aa = a2 - a1 + 1;
  int bb = b2 - b1 + 1;
  int cc = c2 - c1 + 1;
  int dd = d2 - d1 + 1;
  long long ans = (aa * bb * cc * dd) % MOD;
  //

  ans = (ans + 4ll * MOD - paichu(a1, a2, b1, b2, c1, c2, d1, d2) -
         paichu(a1, a2, c1, c2, b1, b2, d1, d2) -
         paichu(a1, a2, d1, d2, b1, b2, c1, c2) -
         paichu(b1, b2, c1, c2, a1, a2, d1, d2) -
         paichu(c1, c2, d1, d2, a1, a2, b1, b2)) %
        MOD;
  cout << ans;
  return 0;
}